function multiDrawEnd()
%NOTE: please use together with multiDraw()
%this function is used to plot multi subplots on on panel
%At the start, it will reset the global parameter
%'Global_multiDrawFunctionSet_figure'
%Version beta 1.0  2015/6/22


global Global_multiDrawFunctionSet_figure;
multiDrawFunctionSet_figure=Global_multiDrawFunctionSet_figure;
clear global Global_multiDrawFunctionSet_figure;

for figureInd=1:length(multiDrawFunctionSet_figure)
    figureSet=multiDrawFunctionSet_figure(figureInd);
    varInGlobal=figureSet.varargin;

    colorbarSwitch=0;
    colorbarPosition=0;
    colormapType='';

    %inteperte varargin-----------------------------------
    argumentN=(length(varInGlobal)-1)/2;
    
    for i=1:argumentN
        if strcmp( varInGlobal{i*2},'colorbar')
            colorbarSwitch=1;
            colorbarAxis=varInGlobal{i*2+1};
        elseif strcmp( varInGlobal{i*2},'colormap')
            colormapType=varInGlobal{i*2+1};
        end
    end
    %-------------------------------------------------------


    for isubplot=1:length(figureSet.subPlotIndex)
        
        if ~isempty(colormapType)
            colormap(colormapType);
        end
        
        if figureSet.tickSwitch(isubplot,1)==0
            set(figureSet.subPlotIndex(isubplot),'xticklabel',[]);
        elseif figureSet.tickSwitch(isubplot,1)==1
            set(figureSet.subPlotIndex(isubplot),'xaxislocation','top')
        end

        if figureSet.tickSwitch(isubplot,2)==0
            set(figureSet.subPlotIndex(isubplot),'yticklabel',[]);
        end


        if isubplot==length(figureSet.subPlotIndex)
            if colorbarSwitch==1
                if colorbarAxis(1)==colorbarAxis(2) %if auto set colorbar
                    colorLimit=zeros(length(figureSet.subPlotIndex),2);
                    for i=1:length(figureSet.subPlotIndex)
                        subplot(figureSet.subPlotIndex(i));
                        colorLimit(i,:)=caxis;
                    end
                    colorbarAxis=[min(colorLimit(:,1)) max(colorLimit(:,2))];
                end
                
                    for i=1:length(figureSet.subPlotIndex)
                        subplot(figureSet.subPlotIndex(i));
                        caxis(colorbarAxis);
                    end

                colorbar('Position', [0.9  0.1+figureSet.SideSqueeze(2)  0.05  0.8-figureSet.SideSqueeze(2)])
        %         colorbarPhoto=Global_multiDrawFunctionSet_subPlotIndex(colorbarPosition);
        % %         colorbarPhoto;
        %         colorbar(location','eastoutside');
        %         colorbarPhotoPos = get(colorbarPhoto,'position');
        %         colorbar('location','eastoutside');
        %         set(colorbarPhoto,'position',colorbarPhotoPos);
            end
        end
    end

end
% if setIndex(1)==0
%     set(gca,'xticklabel',[]);
% elseif setIndex(1)==1
%     set(gca,'xaxislocation','top')
% end
% 
% if setIndex(2)==0
%     set(gca,'yticklabel',[]);
% end



% get(gca);